<html>
<head><meta charset="utf-8"><title>default derives vs custom ones · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/default.20derives.20vs.20custom.20ones.html">default derives vs custom ones</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="161514223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/default%20derives%20vs%20custom%20ones/near/161514223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/default.20derives.20vs.20custom.20ones.html#161514223">(Mar 23 2019 at 08:03)</a>:</h4>
<p>Today I'm trying to provide a workaround for <a href="https://github.com/rust-lang/rust/issues/59375" target="_blank" title="https://github.com/rust-lang/rust/issues/59375">https://github.com/rust-lang/rust/issues/59375</a></p>
<p>I noticed I cannot override PartialEq, is that something that would change in the future or I'm better off using a different name?</p>
<p>(incidentally where is PartialEq implemented?)</p>



<a name="161578012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/default%20derives%20vs%20custom%20ones/near/161578012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/default.20derives.20vs.20custom.20ones.html#161578012">(Mar 24 2019 at 13:08)</a>:</h4>
<blockquote>
<p>Today I'm trying to provide a workaround for <a href="https://github.com/rust-lang/rust/issues/59375" target="_blank" title="https://github.com/rust-lang/rust/issues/59375">https://github.com/rust-lang/rust/issues/59375</a></p>
</blockquote>
<p>Wouldn't you just need to implement <code>PartialEq</code> by hand, applying <code>#[inline(always)</code> to the relevant functions?</p>



<a name="161638405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/default%20derives%20vs%20custom%20ones/near/161638405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/default.20derives.20vs.20custom.20ones.html#161638405">(Mar 25 2019 at 12:38)</a>:</h4>
<p>For the varius enums in rav1e, yes.</p>



<a name="161638591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/default%20derives%20vs%20custom%20ones/near/161638591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/default.20derives.20vs.20custom.20ones.html#161638591">(Mar 25 2019 at 12:40)</a>:</h4>
<p>inline(always) should be a good workaround. And since we have plenty of those enums I wanted to override PartialEq selectively :)</p>



<a name="161659736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/default%20derives%20vs%20custom%20ones/near/161659736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/default.20derives.20vs.20custom.20ones.html#161659736">(Mar 25 2019 at 16:19)</a>:</h4>
<p>What do you mean by "override" and "PartialEq", specifically?</p>



<a name="161659824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/default%20derives%20vs%20custom%20ones/near/161659824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/default.20derives.20vs.20custom.20ones.html#161659824">(Mar 25 2019 at 16:20)</a>:</h4>
<p>For the latter, you might be referring to overriding the <em>trait</em> or the <em>derive</em></p>



<a name="162040265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/default%20derives%20vs%20custom%20ones/near/162040265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/default.20derives.20vs.20custom.20ones.html#162040265">(Mar 29 2019 at 12:09)</a>:</h4>
<blockquote>
<p>What do you mean by "override" and "PartialEq", specifically?</p>
</blockquote>
<div class="codehilite"><pre><span></span><span class="k">use</span><span class="w"> </span><span class="n">mycrate</span>::<span class="nb">PartialEq</span><span class="p">;</span><span class="w"></span>

<span class="cp">#[derive(PartialEq)]</span><span class="w"></span>
<span class="k">enum</span> <span class="nc">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">..</span><span class="w"></span>
</pre></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>